/*
   Copyright (c) 2020 Shanghai Xuanzi Technology Co. Ltd https://xuanzi.ltd
   XZUnitTest is licensed under the Mulan PSL v1.
   You can use this software according to the terms and conditions of the Mulan PSL v1.
   You may obtain a copy of Mulan PSL v1 at:
      http://license.coscl.org.cn/MulanPSL
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
   PURPOSE.
   See the Mulan PSL v1 for more details. 
 */

package xuanzi.h5.unittest.client;

import com.google.gwt.core.client.EntryPoint;

import xuanzi.h5.unittest.Asserts;
import xuanzi.h5.unittest.Console;
import xuanzi.h5.unittest.StepTest;
import xuanzi.h5.unittest.UnitTest;
import xuanzi.h5.unittest.UnitTestUI; 
 

public class TestUnit implements EntryPoint {
	
	static {
		
		Asserts.initNative();
		UnitTest.initNative();
		Console.log("AAA");
	}
	

	public TestUnit() {
		 
			
		  
	}
	
	class Test2 extends UnitTestUI{
		public Test2() {
			super("Unit Test 2"); 
		}

		@Override
		protected void doUnitTest() {
			Asserts.assertTrue("Test True",true);
			Asserts.assertTrue("Test not True",false); 
			
			Asserts.assertTrue("Test not True",false); 

			Asserts.assertFalse("Test not False",false);
			Asserts.assertFalse("Test not False",true);
			{
				getOutEl().createDiv("Test Review").attr("height", "96px");
			}
			{
				Asserts.assertEquals("Test Equals Boolean",true,true);
				Asserts.assertEquals("Test throw Error Boolean error",true,false);
				Asserts.assertEquals("Test throw Error Boolean error",false,true);
				
				Asserts.assertEquals("Test Equals String","abc","abc");
				Asserts.assertEquals("Test throw Error String","abc","abcd");
				
				Asserts.assertEquals("Test Equals Integer",123,123);
				Asserts.assertEquals("Test throw Error Integer",123,124);
				
				Asserts.assertEquals("Test Equals Float",123.4f,123.4f);
				Asserts.assertEquals("Test throw Error Float",123.4f,123.5f);
				
				Asserts.assertEquals("Test Equals Double",123.4d,123.4d);
				Asserts.assertEquals("Test throw Error Double",123.4d,123.5d);
				
				Asserts.assertEquals("Test Equals Long",123l,123l);
				Asserts.assertEquals("Test throw Error Long",123l,124l);
				Asserts.assertEquals("Test throw Error Long",123l,124l);
				Asserts.assertEquals("Test throw Error Long",123l,124l);
			}
			{
				Asserts.assertNotEquals("Test NoEquals throw Error",true,true);
				Asserts.assertNotEquals("Test NoEquals ",true,false);
				Asserts.assertNotEquals("Test NoEquals ",false,true);
				
				
				Asserts.assertNotEquals("Test NoEquals String","123","1234");
				Asserts.assertNotEquals("Test NoEquals String throw Error ","1234","1234");
				
				Asserts.assertNotEquals("Test NoEquals Integer",123,1234);
				Asserts.assertNotEquals("Test NoEquals Integer throw Error ",1234,1234);
			}
			finish();
		}
	}

	class Test3 extends UnitTestUI{
		public Test3() {
			super("Unit Test 3"); 
		}

		@Override
		protected void doUnitTest() {
			Asserts.assertTrue("Test True",true);
			Asserts.assertTrue("Test not True",false); 
			
			Asserts.assertTrue("Test not True",false); 

			Asserts.assertFalse("Test not False",false);
			Asserts.assertFalse("Test not False",true);
			{
				Asserts.assertEquals("Test Equals Boolean",true,true);
				Asserts.assertEquals("Test throw Error Boolean error",true,false);
				Asserts.assertEquals("Test throw Error Boolean error",false,true);
				
				Asserts.assertEquals("Test Equals String","abc","abc");
				Asserts.assertEquals("Test throw Error String","abc","abcd");
				
				Asserts.assertEquals("Test Equals Integer",123,123);
				Asserts.assertEquals("Test throw Error Integer",123,124);
				
				Asserts.assertEquals("Test Equals Float",123.4f,123.4f);
				Asserts.assertEquals("Test throw Error Float",123.4f,123.5f);
				
				Asserts.assertEquals("Test Equals Double",123.4d,123.4d);
				Asserts.assertEquals("Test throw Error Double",123.4d,123.5d);
				
				Asserts.assertEquals("Test Equals Long",123l,123l);
				Asserts.assertEquals("Test throw Error Long",123l,124l);
				Asserts.assertEquals("Test throw Error Long",123l,124l);
				Asserts.assertEquals("Test throw Error Long",123l,124l);
			}
			{
				Asserts.assertNotEquals("Test NoEquals throw Error",true,true);
				Asserts.assertNotEquals("Test NoEquals ",true,false);
				Asserts.assertNotEquals("Test NoEquals ",false,true);
				
				
				Asserts.assertNotEquals("Test NoEquals String","123","1234");
				Asserts.assertNotEquals("Test NoEquals String throw Error ","1234","1234");
				
				Asserts.assertNotEquals("Test NoEquals Integer",123,1234);
				Asserts.assertNotEquals("Test NoEquals Integer throw Error ",1234,1234);
			}
			finish();
		}
	}
	
	@Override
	public void onModuleLoad() { 
		Console.warn("it do now"); 
		{
			Test2 test = new Test2();
			test.start();
		}{
			Test3 test = new Test3();
			test.start();
		}
		
		new StepTest("Test Step") {
			
			@Override
			public void doStep() {
				Asserts.assertNotEquals("Test NoEquals Integer",123,1234);
				Asserts.assertNotEquals("Test NoEquals Integer",123,1234);
				finish();
			}
		}; 
	} 
}
